package com.nsn.auction.dao.impl;

import java.util.List;

import com.nsn.auction.dao.OfferDao;
import com.nsn.auction.domina.Offer;
import com.nsn.auction.util.CustomHibernateDaoSupport;

public class OfferDaoImpl extends CustomHibernateDaoSupport implements OfferDao {

	@Override
	public void save(Offer offer) {
		getHibernateTemplate().save(offer);

	}

	@Override
	public void update(Offer offer) {
		getHibernateTemplate().update(offer);

	}

	@Override
	public void delete(Offer offer) {
		getHibernateTemplate().delete(offer);

	}

	@Override
	public Offer findOfferById(Long offerId) {
		List<Offer> list = getHibernateTemplate().find("from Offer where offerId=?", offerId);
		if (list.size() == 0)
			return null;
		else
			return list.get(0);
	}

}
